home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
Communication
/
NewsBase
/
Source
/
ITreeNodeD.h
< prev
next >
Wrap
Text File
|
1993-01-12
|
2KB
|
66 lines
/*
Each node in the tree is named with a string. No two child nodes of
the same parent node may have the same name. Hence each node in the tree is
uniquely addressed by a key, where a key is a list of strings. Let us call the
nth string of a key the nth subkey. Then the nth subkey specifies the name
of a node at the nth level of a tree. The key then specifies a path through
the tree from the root. The child nodes of a parent node is stored in an
lexigraphically ordered lists. Additionally, each node in the tree may hold
a link to another object. Since each subtree is also a tree the methods may
be called with any node as the root.
*/
#import <objc/Object.h>
#import "IOrderedListD.h"
#define MAX_TREE_STATE_DEPTH 1024
typedef struct {int depth; struct {id node; int index;}nodeState[MAX_TREE_STATE_DEPTH];} NXTreeState;
#define SEARCH 1
#define ADD 2
#define MAX_NO_OF_TOKENS 256
void makeTreeKey(const char *, const char **, const char *);
@interface ITreeNodeD:IOrderedListD {
}
/*
addNodeForKey adds the node for key theKey and any required ancestral nodes.
The id of the created node is returned.
*/
- addNodeForKey:(char **)theKey;
/*
nodeForKey returns the id of the addressed node.
*/
- (ITreeNodeD *)nodeForKey:(char **)theKey;
//- leaf;
//- (void)setLeaf:leaf;
//- link;
//- (void)setLink:link;
/*
searchForNodeWithKey will return the id of the node with key TheKey. If the
node doesn't exists and the opCode is ADD then that node and any ancestral
nodes are add to the tree. If the opCode is SEARCH and the node doesn't
exists then nil is returned. If theLeaf is not nil and the node exists or
is created then that node is linked to the leaf.
*/
- searchForNodeWithKey:(char **)theKey withOption:(int)opCode;
/*
traverseTreeAndPerform: target: traverses the tree and makes target
perform the given method
*/
- (void)traverseTreeAndPerform:(SEL)theSelector target:target;
- (void)initState:(NXTreeState *)state;
- nextState:(NXTreeState *)state;
@end